package Toast;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import android.content.Context;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.util.Log;

public class PropertiesLFM {
	
	public static Properties load_properties(Context context){
		 
		 Resources resources = context.getResources();
		 AssetManager assetManager = resources.getAssets();
		 Properties properties_aux = new Properties();
		 // Read from the /assets directory
		 try {
		     InputStream inputStream = assetManager.open("config_app.properties");
		     properties_aux.load(inputStream);
		     Log.i("LFM_Log","The properties are now loaded");
		     Log.i("LFM_Log","properties: " + properties_aux);
		    
		 } catch (IOException e) {
		     System.err.println("Failed to open microlog property file");
		     e.printStackTrace();
		 }
		 return properties_aux;
	 }//end_load_properties
	
	
	public static boolean  checkFolderApp(String ruta){
        File f = new File(ruta);
      
        if(f==null || (!f.exists() && !f.mkdir())){
            return false;
        }else{
                        return true;
                }
    }

}
